import { defineConfig } from "vite";
import path, { resolve } from "path";
import react from "@vitejs/plugin-react";

// const __dirname = path.dirname(new URL(import.meta.url).pathname);

// 用于webpack打包是
// https://vite.dev/config/
export default defineConfig({
  plugins: [react()],
  // 打包装饰路径
  resolve: {
    alias: {
      "@store": path.resolve(__dirname, "src/store"),
      "@/": path.resolve(__dirname, "src/"),
    },
  },
  // 
  css: {
    preprocessorOptions: {
      less: {
        // 配置全局引入less变量文件
        additionalData: `@import "${path.resolve(__dirname, 'src/styles/variables.less')}"`,
        javascriptEnabled: true,
      }
    }
  }
});
